/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

/**
 * 图表数据合集
 *  */
import request from '@/utils/request';

// const host = '';
// const host = 'http://gp.chinapostcnps.com/static/js/city_web';

// 获取地图数据
export const getMapData = async params => {
  const { adcode, level, parentAdCode } = params;
  if (!adcode) return null;
  const isDev = process.env.NODE_ENV === 'development';
  let url = isDev ? `/database/${adcode}_full.json` : `/dist/database/${adcode}_full.json`;
  if (level == 4) {
    url = url.replace(/database/g, `database/${parentAdCode}`);
  }
  return request(url, {
    method: 'GET',
    data: params,
  });
};
// 获取地图驿站数据
export async function getAreaYzData(params) {
  return request('/Api/Statistics/areaData', {
    method: 'POST',
    body: params,
  });
}
// 获取实时出入库、新增站点、寄件订单数
export async function getRealTimeData(params) {
  return request('/Api/Statistics/count', {
    method: 'POST',
    body: params,
  });
}
// 获取昨日数据
export async function getYesterdayDate(params) {
  return request('/Api/Statistics/yesterdayBoard', {
    method: 'POST',
    body: params,
  });
}
// 获取昨日入库数
export async function getYesterdayInNum(params) {
  return request('/Api/Statistics/rank', {
    method: 'POST',
    body: params,
  });
}
// 7日出入库数
export async function storageSummary(params) {
  return request('/Api/Statistics/storageSummary', {
    method: 'POST',
    body: params,
  });
}
// 近7日共配扫描数
export async function pdaSummary(params) {
  return request('/Api/Statistics/pdaSummary', {
    method: 'POST',
    body: params,
  });
}
// 7日入库品牌占比
export async function brandsRate(params) {
  return request('/Api/Statistics/storagePic', {
    method: 'POST',
    body: params,
  });
}
// 下属驿站列表
export async function getSubDaksList(params) {
  return request('/Api/Statistics/getSubDaksList', {
    method: 'POST',
    body: params,
  });
}

// 宇视-获取有设备的驿站id
export async function getHasVideoCmId(params) {
  return request('/Api/Statistics/getHasVideoCmId', {
    method: 'POST',
    body: params,
  });
}

// 宇视-获取宇视通道号
export async function getCityChannelList(params) {
  return request('/Api/Statistics/getCityChannelList', {
    method: 'POST',
    body: params,
  });
}

// 宇视-获取播放视频地址
export async function playCityVideos(params) {
  return request('/Api/Statistics/playCityVideos', {
    method: 'POST',
    body: params,
  });
}
// 宇视-开启推流
export async function videoCityStart(params) {
  return request('/Api/Statistics/videoCityStart', {
    method: 'POST',
    body: params,
  });
}
// 宇视-结束推流
export async function videoCityStop(params) {
  return request('/Api/Statistics/videoCityStop', {
    method: 'POST',
    body: params,
  });
}
// 中邮大屏，获取驿站近7天数据
export async function getYzDetailInSeven(params) {
  return request('/Api/Statistics/innData', {
    method: 'POST',
    body: params,
  });
}
/**
 * 中邮共配大屏，获取昨日到派签数据
 *  */
export async function getYzGpYesterdayDate(params) {
  return request('/v1/TotalDistribution/ChinaPostTongji/getYdayTongjiData', {
    method: 'POST',
    body: params,
  });
}
/**
 * 中邮共配大屏，获取昨日每小时到件量排名
 *  */
export async function getYzGpYesterdayArrivalRank(params) {
  return request('/v1/TotalDistribution/ChinaPostTongji/getYdayEveryHourArrivalRanking', {
    method: 'POST',
    body: params,
  });
}
/**
 * 中邮共配大屏，获取昨日到件品牌排名
 *  */
export async function getYzGpYesterdayBrandArrivalRank(params) {
  return request('/v1/TotalDistribution/ChinaPostTongji/getYdayArrivalBrandRanking', {
    method: 'POST',
    body: params,
  });
}
/**
 * 中邮共配大屏，获取近7日到件量
 *  */
export async function getYzGpSevenRank(params) {
  return request('/v1/TotalDistribution/ChinaPostTongji/getweekArrivalSum', {
    method: 'POST',
    body: params,
  });
}
/**
 * 中邮共配大屏，获取近7日到件量品牌占比
 *  */
export async function getYzGpArriveBrandRate(params) {
  return request('/v1/TotalDistribution/ChinaPostTongji/getweekArrivalBrandRanking', {
    method: 'POST',
    body: params,
  });
}
/**
 * 中邮共配大屏，获取今日实时数据
 *  */
export async function getYzGpArriveRealTimeDate(params) {
  return request('/v1/TotalDistribution/ChinaPostTongji/getTodayTongjiSum', {
    method: 'POST',
    body: params,
  });
}
/**
 * 中邮共配大屏，获取地区热力图数据
 *  */
export async function getYzGpAreaDate(params) {
  return request('/v1/TotalDistribution/ChinaPostTongji/getHeatMapData', {
    method: 'POST',
    body: params,
  });
}
